package com.wysql.iostream;

import java.io.*;

public class CopybyStream {
    public static void main(String[] args) {
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            bis = new BufferedInputStream(new FileInputStream("D:\\temp\\demo1\\src\\main\\resources\\banner.txt"));
            bos = new BufferedOutputStream(new FileOutputStream("IOstream/src/filebook/a.txt"));

            byte[] bytes = new byte[1024];
            int len;
            while ((len = bis.read(bytes)) != -1) {
                bos.write(bytes, 0, len);
            }

        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                bis.close();
                bos.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
